"""
字符串常用操作

Version: 0.1
Author: yuwl
Date：2024-4-08
"""

# 转义
print('My brother\'s name is \'007\'')
# 原始
print(r'My brother\'s name is \'007\'')

str = 'hello123world'
print('he' in str)
print('her' in str)
# 是否只包含字母
print(str.isalpha())
# 是否只包含字母和数字
print(str.isalnum())
# 是否只包含数字
print(str.isdecimal())

print(str[0:5].isalpha())
print(str[5:8].isdecimal())

list = ['床前明月光', '疑是地上霜', '举头望明月', '低头思故乡']
print('-'.join(list))

sentence = 'You go your way I will go mine'
print(sentence.split())

email = '     jackfrued@126.com          '
print(email)
# 去除字符串两端的字符
print(email.strip())
# 去除字符串开头的字符
print(email.lstrip())

s = "##Hello, World!##"
print(s.strip('#'))  # 输出: "Hello, World!"

s = "##Hello, World!##"
print(s.lstrip('#'))  # 输出: "Hello, World!##"

